package com.leetcode.LC;

public class LC441 {
    public int arrangeCoins(int n) {
        int tmp = n;
        for (int i = 1; i <= n; i++) {
            if (tmp - i < 0) {
                return i - 1;
            } else if (tmp - i == 0) {
                return i;
            } else {
                tmp -= i;
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        System.out.println(new LC441().arrangeCoins(1));
    }
}
